// 头部导航模块
import { findHeadCategory } from '@/api/home'
const category = {
  namespaced: true,
  state: () => {
    return {
      list: [] // 首页头部导航列表
    }
  },
  mutations: {
    setList (state, n) {
      // 把值保存到list里面
      state.list = n
    }
  },
  actions: {
    async setListFn (ctx) {
      // 发送请求,获取头部导航数据
      const res = await findHeadCategory()
      // console.log(res)
      ctx.commit('setList', res.result)
    }
  }
}
export default category
